![]() |
DrawString |
||||
Header: | QuickdrawText.h | Carbon status: | Supported | |
Draws the text of the specified Pascal string at the pen location in the current graphics port (GrafPort or CGrafPort).
void DrawString ( ConstStr255Param s );
A Pascal string consisting of the text to be drawn.
The DrawString function draws the string with its left edge at the current pen location, extending right. The final position of the pen location, after the text is drawn, is to the right of the rightmost glyph in the string. QuickDraw does not do any formatting, such as handling of carriage returns or line feeds.
Note that you can use DrawString only for a Pascal string containing a single style run.
QuickDraw temporarily stores on the stack all of the text you ask it to draw, even if the text is to be clipped. When drawing large font sizes or complex style variations, draw only what is visible on the screen. You can determine the number of characters whose corresponding glyphs actually fit on the screen by calling the StringWidth function to determine the length of the string before calling DrawString.
If you specify values in the graphics port spExtra or chExtra fields to change the width of space or nonspace characters, DrawString takes these values into account.
For right-to-left text, such as Hebrew or Arabic, QuickDraw draws the final (leftmost) glyph first, then moves to the right through all the glyphs, drawing the initial (rightmost) glyph last.
Note that you should not change the width of nonspace characters for 1-byte simple script systems with zero-width characters or 1-byte complex script systems. For more information, see CharExtra.
For contextual script systems, DrawString substitutes the proper ligatures, reversals, and compound characters as needed. Inside a picture definition, DrawString can’t have a byteCount greater than 255.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)